package cn.iocoder.yudao.module.biz.dal.mysql.specialWork;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.biz.dal.dataobject.specialWork.BizSpecialWorkDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.biz.controller.admin.specialWork.vo.*;

/**
 * 工种 Mapper
 *
 * @author guangpu
 */
@Mapper
public interface BizSpecialWorkMapper extends BaseMapperX<BizSpecialWorkDO> {

    default PageResult<BizSpecialWorkDO> selectPage(BizSpecialWorkPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BizSpecialWorkDO>()
                .eqIfPresent(BizSpecialWorkDO::getWorkTypeId, reqVO.getWorkTypeId())
                .likeIfPresent(BizSpecialWorkDO::getName, reqVO.getName())
                .betweenIfPresent(BizSpecialWorkDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(BizSpecialWorkDO::getId));
    }

    default List<BizSpecialWorkDO> selectList(BizSpecialWorkExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BizSpecialWorkDO>()
                .eqIfPresent(BizSpecialWorkDO::getWorkTypeId, reqVO.getWorkTypeId())
                .likeIfPresent(BizSpecialWorkDO::getName, reqVO.getName())
                .betweenIfPresent(BizSpecialWorkDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(BizSpecialWorkDO::getId));
    }

}
